home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks97
/
WarriorsProgress.sit
/
Warrior’s Progress
/
source code
/
Source
/
Libraries
/
Miscellany
/
New.cp
< prev
next >
Wrap
Text File
|
1997-06-28
|
644b
|
44 lines
// New.cp
#ifndef New_h
#include "New.h"
#endif
#ifndef MemoryFullError_h
#include "MemoryFullError.h"
#endif
#ifndef __ERRORS__
#include <Errors.h>
#endif
#ifndef Assert_h
#include "Assert.h"
#endif
void *operator new( uint32 size )
{
void *result = NewPtr( size );
OSErr error( MemError() );
if ( error == memFullErr )
throw MemoryFullError();
if ( error != noErr )
throw MemoryError( error );
if ( result == 0 )
throw MemoryFullError();
return result;
}
void operator delete( void *p )
{
Assert( p != 0 );
if ( p == 0 )
return;
DisposePtr( static_cast<Ptr>( p ) );
MemoryError::Check().Throw();
}